package com.fanbuchi.fukua.service;

import com.fanbuchi.fukua.api.API;
import com.fanbuchi.fukua.entity.Result;
import com.fanbuchi.fukua.entity.apps.Apps;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.http.GET;
import retrofit.http.Path;
import retrofit.http.Query;

/**
 * Created by rabbit on 2015/5/30.
 */
public class HttpClient {
    private static final String API_URL = API.getHost();

    //apps group
   // http://fanbuchi.com:8082/api/apps/checkVersion?packageName=com.rrkd.app&versionName=bajie
   public static void checkVersion(String packageName,String versionName,Callback<Result<Apps>> callback) {
       RestAdapter restAdapter = new RestAdapter.Builder()

               .setEndpoint(API_URL)
                .setLogLevel(RestAdapter.LogLevel.FULL)
               .build();

       // Create an instance of our GitHub API interface.
       ApiAppsService1 apiAppsService = restAdapter.create(ApiAppsService1.class);

       // Fetch and print a list of the contributors to this library.
       apiAppsService.checkVersion("com.rrkd.app", "bajie", callback);
   }


    public interface ApiAppsService1 {

        @GET("/apps/checkVersion")
        void checkVersion(@Query("packageName") String packageName, @Query("versionName") String versionName, Callback<Result<Apps>> callback);



    }


}
